<script lang="ts" setup>
  import { requestUpdateDetectionInfo } from '@/api/business/tracecode/detectionInfo'
  import BottomButton from '@/components/BottomButton/BottomButton.vue'
  import { HttpCodeEnum } from '@/enum/httpEnum'
  import { microbiotaPng } from '@/enum/imageEnum'

  import Layout from './components/Layout.vue'
  import Progress from './components/Progress.vue'
  import {PAGE_TITLE} from '@/enum/pageEnum'
  const props = defineProps<{ detectionInfoId: string }>()
  const toHome = async () => {
    const { responseCode, responseMessage } = await requestUpdateDetectionInfo({
      detectionInfoId: props.detectionInfoId,
      status: 40,
      detectionType: 1,
    })
    if (responseCode === HttpCodeEnum.SUCCESS) {
      wx.switchTab({
        url: '/pages/tabbar/microbiota',
      })
    } else {
      uni.showToast({ title: responseMessage, icon: 'none' })
    }
  }
</script>

<template>
  <Layout :title="PAGE_TITLE" :is-scroll="true">
    <template #progress> <Progress step="3" :type="1"  name="样本快递" /></template>
    <template #content>
      <view class="">
        <view class="tips"> 请长按识别，联系快递员上门取件 </view>
        <view class="tips1"> 二维码已包含收件地址信息 </view>
        <image :src="microbiotaPng.shunfeng" class="image" mode="widthFix" show-menu-by-longpress />
        <view class="tips2"> 将跳转至顺丰快递小程序 </view>
      </view>
    </template>
    <template #button>
      <BottomButton buttonText="取件完成" @on-click="toHome()" :is-pre="false"/>
    </template>
  </Layout>
</template>

<style lang="less" scoped>
  :deep(.content) {
    margin-top: 48rpx !important;
  }

  .tips {
    font-size: 32rpx;
    font-weight: 500;
    color: #08979c;
    text-align: center;
  }

  .tips1 {
    margin: 16rpx 0 48rpx;
    font-size: 28rpx;
    color: #4e5969;
    text-align: center;
  }

  .image {
    width: 100%;
  }

  .tips2 {
    margin-top: 32rpx;
    font-size: 28rpx;
    color: #86909c;
    text-align: center;
  }
</style>
